package com.ccnode.codegenerator.taikaoback.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import java.util.Collection;
import java.util.Collections;

@Data
@NoArgsConstructor
@AllArgsConstructor
@ToString
public class LoginUser implements UserDetails {

    // 储存登录用户信息
    private String userid;
    private String username;
    private String password;
    private String phone;
    private String smscode;
    private String captcha;

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        // 暂时返回空集合，后续可以根据实际权限设计进行扩展
        return Collections.emptyList();
    }

    @Override
    public String getPassword() {
        return password;
    }

    @Override
    public String getUsername() {
        return username;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }
}